package com.template.config;

import com.template.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//p配置拦截器
//https://blog.csdn.net/heihaozi/article/details/131428958
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/user/**","/ws/**","/page/**","/comment/**")//添加拦截路由
                .excludePathPatterns("/login", "/register");//忽略的拦截路由
    }
}


